# Acquire AppSealing device unique identifier_Xcode
AppSealing SDK generates and manages unique identifier for each device. Customer who use the AppSealing SDK can use the interface of AppSealing to verify the device unique identifier, if necessary. And can be used for the business using the hacking data service provided by AppSealing.
# Show acquire device unique identifier
First, open your Xcode project and open “ViewController.swift” file. After you opened the swift file put following code into that (If ViewController.swift file has already included 'viewDidAppear' method just insert the body of following code below 'super.viewDidAppear( animated );' line.)
Simple UI code into ‘ViewController.swift’ for Swift project
override func viewDidAppear(_ animated: Bool)
{
super.viewDidAppear( animated );
let inst: AppSealingInterface = AppSealingInterface();
let appSealingDeviceID = String.init( cString: inst._GetAppSealingDeviceID() );
let alertController = UIAlertController( title: "AppSealing DeviceID",
message: appSealingDeviceID, preferredStyle: .alert );
alertController.addAction( UIAlertAction( title: "Confirm", style: .default ));
self.present( alertController, animated: true, completion: nil );
}
Sample code is also included in “AppSealingiOS.mm” file so you can copy & paste in that file.
If your project is Objective-C based then you can use following code to show simple UI.
Simple UI code into ‘ViewController.mm (opens new window)’ for Objective-C project
#include "AppsealingiOS.h"
char _appSealingDeviceID[64];
- (void)viewDidAppear:(BOOL)animated
{
[super viewDidAppear:animated];
if ( ObjC_GetAppSealingDeviceID( _appSealingDeviceID ) == 0 )
{
UIAlertController *alert = [UIAlertController alertControllerWithTitle:@"AppSealing DeviceID"
message:[[NSString alloc] initWithUTF8String:_appSealingDeviceID]
preferredStyle:UIAlertControllerStyleAlert];
UIAlertAction *confirm = [UIAlertAction actionWithTitle:@"Confirm"
style:UIAlertActionStyleDefault
handler:^(UIAlertAction * _Nonnull action) { }];
[alert addAction:confirm];
[self presentViewController:alert animated:YES completion:nil];
}
}
Your app will show simple alert box like below when you run your app.